﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Dingding.Helper;

using System.Net;
using System.Text;

using System.Data;
using System.Collections;

using System.IO;
using Common;
using System.Configuration;

namespace MySqlApi
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //  this.TextBox1.Text = PostWebApi3("http://localhost:58361/api/Index/PostIndex_Load");
            //  this.TextBox1.Text = PostWebApi3("http://localhost:58361/api/Pono_No/PostPono_No_GetV1");
            //   this.TextBox1.Text = PostWebApi3("http://localhost:58361/api/Tmm0001/PostTmm0001_Upd");

            //第三次修改

            this.TextBox1.Text = "vscode  first updd";

        }





        private static string PostWebApi3(string host,string str1,string str2)
        {
            string result = "";
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(host);
            req.Method = "POST";
            req.ContentType = "application/x-www-form-urlencoded";
            #region 添加Post 参数
            StringBuilder builder = new StringBuilder();

             
   
            builder.AppendFormat("{0}={1}", "IP", str1);  

            builder.Append("&");
            builder.AppendFormat("{0}={1}", "TYPE", str2);
             

            byte[] data = Encoding.UTF8.GetBytes(builder.ToString());
            req.ContentLength = data.Length;
            using (Stream reqStream = req.GetRequestStream())
            {
                reqStream.Write(data, 0, data.Length);
                reqStream.Close();
            }
            #endregion
            HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
            Stream stream = resp.GetResponseStream();
            //获取响应内容
            using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
            {
                result = reader.ReadToEnd();
            }
            return result;
        }

    

        
 

        protected void Button7_Click(object sender, EventArgs e)
        {


            List<string> dynamicArray = new List<string>();

            

            // 添加元素
            dynamicArray.Add("Hello");
            dynamicArray.Add("World");

            foreach (var item in dynamicArray)
            {
                string str = item; 
            }

            string ss = dynamicArray[0];


                //string myCustomSetting = ConfigurationManager.AppSettings["75NUMA"];
                //string myCustomSetting3 = ConfigurationManager.AppSettings["75NUMC"];
                //string myCustomSetting2 = ConfigurationManager.AppSettings["75NUMB"];


            string host = ConfigurationManager.AppSettings["host"];

            if (host != null)
                host = host + "/YGL2/api/PicNum/PostGetPicNum";
            else
                host = "http://10.97.36.67/YGL2/api/PicNum/PostGetPicNum";

             
                //string[] imageUrl = {"-1","-1"};//表示异常； 
                //imageUrl[0] = "abc"; 
                //return; 

                //string[] stringArray = new string[2]; 
                //stringArray[0] = "abc"; 
                //return;


                // this.TextBox1.Text = PostWebApi3("http://10.97.36.67/YGL2/api/PicNum/PostGetPicNum", this.TextBox2.Text, this.TextBox3.Text);
                this.TextBox1.Text = PostWebApi3(host, this.TextBox2.Text, this.TextBox3.Text);

        }
    }

    internal class ConfigurationBuilder
    {
        public ConfigurationBuilder()
        {
        }
    }
}